<?php

class Collection
{
	public $Objects = array( );
	public function Add( $Object )
	{
		$this->Objects[] = $Object;
	}
	public function Count( )
	{
		return count( $this->Objects );
	}
	public function __set( $Key, $Value )
	{
		foreach( $this->Objects as $Object )
		{
			$Object->$Key = $Value;
		}
	}
	public function __get( $Key )
	{
		$C = new Collection( );
		foreach( $this->Objects as $Object )
		{
			$C->Add( $Object->$Key );
		}
		return $C;
	}
	public function __call( $Name, $Args )
	{
		$C = new Collection( );
		foreach( $this->Objects as $Object )
		{
			$Code = '$Retval = $Object->' . $Name . '( ' . implode( ',', $Args ) . ' );';
			eval( $Code );
			$C->Add( $Retval );
		}
		return $C;
	}
}

?>